package com.github.sub.inter;

import com.github.Common;

import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static com.github.MyAutoTestContext.BLANK;
import static com.github.MyAutoTestContext.DBLANK;

public class MethodCommander extends Common implements com.github.Commander {


    @Override
    public Object run(Map<String, String> command) {
        //此处为通用逻辑可以封装
        String[] keyValue = command.get("-m").split(DBLANK);
        List<String> collect = Arrays.stream(keyValue).filter(s -> !s.equals(DBLANK)).collect(Collectors.toList());
        String aliasName = collect.get(0);
        String domain = read(new File(alias + File.separator + aliasName));
        tradition.outPutFile(collect.get(1).getBytes(), method, domain.hashCode() + BLANK);
        return null;
    }
}
